﻿@using System.Web.Optimization
@using BlogEngine.Core
@using BlogEngine.Core.Data.Services
@{
    if (!Security.IsAuthorizedTo(Rights.AccessAdminPages))
    {
        Security.RedirectForUnauthorizedRequest();
    }
    string loginUrl = Href(Utils.RelativeWebRoot + "Account/login.aspx");
    var userRights = string.Join("','", Security.CurrentUserRights().Select(r => r.Flag).ToArray());

    var name = Security.CurrentUser.Identity.Name;
    var email = Membership.Provider.GetUser(name, true).Email;
    var profile = new AuthorProfile(name);
    var src = profile.PhotoUrl;
    if (string.IsNullOrEmpty(src))
    {
        src = Avatar.GetSrc(email);
    }
}
<html ng-app="blogAdmin">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>@BlogSettings.Instance.Name (@Security.CurrentMembershipUser.UserName)</title>
    <link href="http://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
    @Styles.Render("~/Content/admincss")
    <link href="~/admin/themes/standard/css/styles.css?ver=4" rel="stylesheet">
    <link rel="shortcut icon" href="@Href(Utils.ApplicationRelativeWebRoot + "Content/images/blog/blogengine.ico")" type="image/x-icon" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <script type="text/javascript">
        var UserVars = { Name: '@Html.Raw(Security.CurrentUser.Identity.Name)', IsAdmin: '@Security.IsAdministrator', Rights: ['@Html.Raw(userRights)'] };
        var ActiveTheme = '@BlogSettings.Instance.Theme'
        var UsageScenario = '@BlogConfig.UsageScenario'
        var ServerTime = '@DateTime.Now'
        var UtcTime = '@DateTime.UtcNow'
        if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
            var msViewportStyle = document.createElement("style");
            var mq = "@@-ms-viewport{width:auto!important}";
            msViewportStyle.appendChild(document.createTextNode(mq));
            document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
        }
    </script>
</head>
<body class="@Resources.labels.LangDirection-dir">
    <script type="text/javascript" src="admin.res.axd"></script>
    <div class="main-wrapper">
        <div class="main-sidebar">
            @RenderPage("sidebar.cshtml")
        </div>
        <div class="main-content">
            @RenderBody()
        </div>
        <div class="main-overlay"></div>
    </div>
    <script>
        $(".sidebar-toggle").click(function () {
            $(".main-wrapper").toggleClass("sidebar-open");
        });
        $(".main-overlay").click(function () {
            $(".main-wrapper").removeClass("sidebar-open");
        });

        $(".sub-nav-sidebar li").click(function () {
            $(".main-wrapper").removeClass("sidebar-open");
        });

        $(window).resize(function () {
            if ($(window).width() > 1025) {
                $(".main-wrapper").removeClass("sidebar-open");
            }
        });

    </script>
</body>
</html>